//
//  FirstViewController.m
//  JDFinance
//
//  Created by 黄平 on 2016/12/2.
//  Copyright © 2016年 黄平. All rights reserved.
//

#import "FirstViewController.h"

@interface FirstViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UIButton*but1,*but2,*but3,*but4,*but5,*but6,*but7;
    UILabel*label1,*label2,*label3;
    
}
@property(strong,nonatomic)UITableView*tableview;
@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor=[UIColor whiteColor];
    self.navigationController.navigationBar.clipsToBounds = YES;
    UIBarButtonItem*right1=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"三个点.png"] style:UIBarButtonItemStylePlain target:self action:@selector(Clickright1:)];
       UIBarButtonItem*right2=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"消息中心.png"] style:UIBarButtonItemStylePlain target:self action:@selector(Clickright2:)];
       UIBarButtonItem*right3=[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"扫描二维码.png"] style:UIBarButtonItemStylePlain target:self action:@selector(Clickright3:)];
    self.navigationItem.rightBarButtonItems=@[right1,right2,right3];
    _tableview=[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
    [self.view addSubview:self.tableview];
    _tableview.delegate=self;
    _tableview.dataSource=self;
    //表格cell间隔
   
    ////////////////////////////
    but1=[UIButton buttonWithType:UIButtonTypeCustom];
    but1.frame=CGRectMake(20, 10, 60, 60);
    but1.layer.borderWidth=1;
    but1.layer.cornerRadius=30;
    but1.layer.masksToBounds=YES;
//  [but1.layer setBorderWidth:2];边框宽度
    but1.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but1 setImage:[UIImage imageNamed:@"头像.jpg"] forState:UIControlStateNormal];
    
    
    but2=[UIButton buttonWithType:UIButtonTypeCustom];
    but2.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/4, 5, [UIScreen mainScreen].bounds.size.width/4, 40);
    [but2 setTitle:@"71.3" forState:UIControlStateNormal];
    but2.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but2 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];//字体颜色
    but2.titleLabel.font = [UIFont systemFontOfSize: 20.0];//字体大小
    
    
    
    but3=[UIButton buttonWithType:UIButtonTypeCustom];
    but3.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/4, 40, [UIScreen mainScreen].bounds.size.width/4, 40);
    [but3 setTitle:@"小白信用" forState:UIControlStateNormal];
    but3.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but3 setTitleColor:[UIColor grayColor]forState:UIControlStateNormal];//字体颜色
    but3.titleLabel.font = [UIFont systemFontOfSize: 14.0];//字体大小
    
    
    but4=[UIButton buttonWithType:UIButtonTypeCustom];
    but4.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/2, 5, [UIScreen mainScreen].bounds.size.width/4, 40);
    [but4 setTitle:@"低" forState:UIControlStateNormal];
    but4.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but4 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];//字体颜色
    but4.titleLabel.font = [UIFont systemFontOfSize: 20.0];//字体大小
    
    
    
    but5=[UIButton buttonWithType:UIButtonTypeCustom];
    but5.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/2, 40, [UIScreen mainScreen].bounds.size.width/4, 40);
    [but5 setTitle:@"我的保障" forState:UIControlStateNormal];
    but5.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but5 setTitleColor:[UIColor grayColor]forState:UIControlStateNormal];//字体颜色
    but5.titleLabel.font = [UIFont systemFontOfSize: 14.0];//字体大小
    
    but6=[UIButton buttonWithType:UIButtonTypeCustom];
    but6.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/4*3, 5, [UIScreen mainScreen].bounds.size.width/4, 40);
    [but6 setTitle:@"去签到" forState:UIControlStateNormal];
    but6.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but6 setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];//字体颜色
    but6.titleLabel.font = [UIFont systemFontOfSize: 20.0];//字体大小
    
    
    but7=[UIButton buttonWithType:UIButtonTypeCustom];
    but7.frame=CGRectMake([UIScreen mainScreen].bounds.size.width/4*3, 40, [UIScreen mainScreen].bounds.size.width/4, 40);
    [but7 setTitle:@"会员中心" forState:UIControlStateNormal];
    but7.layer.borderColor=[UIColor whiteColor].CGColor;//边框颜色
    [but7 setTitleColor:[UIColor grayColor]forState:UIControlStateNormal];//字体颜色
    but7.titleLabel.font = [UIFont systemFontOfSize: 14.0];//字体大小
    
    ///////////////////////////
    
    label1=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 80)];
    label1.backgroundColor = [UIColor clearColor];//透明色
    label1.text=@"总资产(元)";
    label1.textColor=[UIColor colorWithRed:159.00/255 green:159.00/255 blue:159.00/255 alpha:1];
    
    label2=[[UILabel alloc]initWithFrame:CGRectMake(0, 90, [UIScreen mainScreen].bounds.size.width, 80)];
    label2.text=@"5.81";
    label2.textColor=[UIColor blackColor];
    label2.font = [UIFont systemFontOfSize:6]; //⼀一般方法
    label2.font = [UIFont boldSystemFontOfSize:20]; //加粗方法
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section==0) {
        return 2;
    }else if (section==1){
        return 2;
    }else if (section==2){
        return 2;
    
    }return 2;
    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        return 80;
    }
    if (indexPath.section==1) {
        return 160;
    }
    if (indexPath.section==2) {
        return 80;
    }
    return 1;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellID =@"cell";
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:CellID];
    if (cell==nil) {
        cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
    }
    if (indexPath.section ==0){
        [cell addSubview:but1];
        [cell addSubview:but2];
        [cell addSubview:but3];
        [cell addSubview:but4];
        [cell addSubview:but5];
        [cell addSubview:but6];
        [cell addSubview:but7];
    }
    if (indexPath.section ==1){
        if (indexPath.row==0) {
            [cell addSubview:label1];
            [cell addSubview:label2];
        }
    }
    
    return cell;
}
- (void)viewDidAppear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    self.navigationController.navigationBar.hidden = NO;
    [self.navigationItem setHidesBackButton:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
